package rulebase;

import java.awt.event.ActionListener;
import java.awt.event.ItemListener;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTextField;


public class MorphophoneticPrefixSpelloutRulePanel extends JPanel
{
	private JList MorphophoneticPreFeaturesList;
	private JComboBox cbxMorphophoneticPrefix;
	private JComboBox cbxMorphophoneticPreInfix;
	private JComboBox cbxMorphophoneticPreStem;
	private JTextField txtMorphophoneticNewPrefix;
	private JTextField txtMorphophoneticPrefix;
	private JTextField txtMorphophoneticPreInfix;
	private JTextField txtMorphophoneticPreNewInfix;
	private JTextField txtMorphophoneticPreStem;
	private JTextField txtMorphophoneticPreNewStem;
	private JCheckBox chkMorphophoneticPrefixReduplication;
	private JCheckBox chkMorphophoneticPreInfixReduplication;
	private JCheckBox chkMorphophoneticPreStemReduplication;
	
	public MorphophoneticPrefixSpelloutRulePanel()
	{
		setLayout(null);
		initGUI();
	}
	
	private void initGUI()
	{
		MorphophoneticPreFeaturesList = new JList();
		MorphophoneticPreFeaturesList.setBounds(213, 223, 201, 129);
		add(MorphophoneticPreFeaturesList);
		
		JLabel lblMorphophoneticPrefix = new JLabel("Prefix");
		lblMorphophoneticPrefix.setBounds(10, 82, 46, 14);
		add(lblMorphophoneticPrefix);
		
		JLabel lblMorphophoneticPreInfix = new JLabel("Infix");
		lblMorphophoneticPreInfix.setBounds(222, 82, 46, 14);
		add(lblMorphophoneticPreInfix);
		
		JLabel lblMorphophoneticPreNewInfix = new JLabel("New Infix");
		lblMorphophoneticPreNewInfix.setBounds(222, 113, 57, 14);
		add(lblMorphophoneticPreNewInfix);
		
		JLabel lblMorphophoneticPreFeatures = new JLabel("Features");
		lblMorphophoneticPreFeatures.setBounds(222, 198, 46, 14);
		add(lblMorphophoneticPreFeatures);
		
		JLabel lblMorphophoneticNewPrefix = new JLabel("New Prefix");
		lblMorphophoneticNewPrefix.setBounds(10, 113, 57, 14);
		add(lblMorphophoneticNewPrefix);
		
		JLabel lblMorphophonecticPreNewStem = new JLabel("New Stem");
		lblMorphophonecticPreNewStem.setBounds(10, 297, 57, 14);
		add(lblMorphophonecticPreNewStem);
		
		JLabel lblMorphophoneticPreStem = new JLabel("Stem");
		lblMorphophoneticPreStem.setBounds(10, 266, 46, 14);
		add(lblMorphophoneticPreStem);
		
		cbxMorphophoneticPrefix = new JComboBox();
		cbxMorphophoneticPrefix.setBounds(10, 11, 150, 20);
		add(cbxMorphophoneticPrefix);
		
		cbxMorphophoneticPreInfix = new JComboBox();
		cbxMorphophoneticPreInfix.setBounds(222, 11, 150, 20);
		add(cbxMorphophoneticPreInfix);
		
		cbxMorphophoneticPreStem = new JComboBox();
		cbxMorphophoneticPreStem.setBounds(10, 195, 150, 20);
		add(cbxMorphophoneticPreStem);
		
		txtMorphophoneticPrefix = new JTextField();
		txtMorphophoneticPrefix.setBounds(80, 79, 80, 20);
		add(txtMorphophoneticPrefix);
		txtMorphophoneticPrefix.setColumns(10);
		
		txtMorphophoneticNewPrefix = new JTextField();
		txtMorphophoneticNewPrefix.setBounds(80, 110, 80, 20);
		add(txtMorphophoneticNewPrefix);
		txtMorphophoneticNewPrefix.setColumns(10);
		
		txtMorphophoneticPreNewInfix = new JTextField();
		txtMorphophoneticPreNewInfix.setBounds(292, 113, 80, 20);
		add(txtMorphophoneticPreNewInfix);
		txtMorphophoneticPreNewInfix.setColumns(10);
		
		txtMorphophoneticPreInfix = new JTextField();
		txtMorphophoneticPreInfix.setBounds(292, 82, 80, 20);
		add(txtMorphophoneticPreInfix);
		txtMorphophoneticPreInfix.setColumns(10);
		
		txtMorphophoneticPreStem = new JTextField();
		txtMorphophoneticPreStem.setBounds(80, 263, 80, 20);
		add(txtMorphophoneticPreStem);
		txtMorphophoneticPreStem.setColumns(10);
		
		txtMorphophoneticPreNewStem = new JTextField();
		txtMorphophoneticPreNewStem.setBounds(80, 294, 80, 20);
		add(txtMorphophoneticPreNewStem);
		txtMorphophoneticPreNewStem.setColumns(10);
		
		chkMorphophoneticPrefixReduplication = new JCheckBox("Reduplication");
		chkMorphophoneticPrefixReduplication.setBounds(10, 38, 97, 23);
		add(chkMorphophoneticPrefixReduplication);
		
		chkMorphophoneticPreInfixReduplication = new JCheckBox("Reduplication");
		chkMorphophoneticPreInfixReduplication.setBounds(222, 38, 97, 23);
		add(chkMorphophoneticPreInfixReduplication);
		
		chkMorphophoneticPreStemReduplication = new JCheckBox("Reduplication");
		chkMorphophoneticPreStemReduplication.setBounds(10, 223, 97, 23);
		add(chkMorphophoneticPreStemReduplication);
		
		initCbxMorphophoneticPrefixItems();
		initCbxMorphophoneticPreInfixItems();
		initCbxMorphophoneticPreStemItems();
	}

	private void initCbxMorphophoneticPrefixItems()
	{
		DefaultComboBoxModel model = new DefaultComboBoxModel();
		model.addElement("Prefix doesn't change");
		model.addElement("End of prefix changes");
		model.addElement("Entire prefix changes");
		cbxMorphophoneticPrefix.setModel(model);
	}
	
	private void initCbxMorphophoneticPreInfixItems()
	{
		DefaultComboBoxModel model = new DefaultComboBoxModel();
		model.addElement("Infix doesn't change");
		model.addElement("End of infix changes");
		model.addElement("Entire infix changes");
		cbxMorphophoneticPreInfix.setModel(model);
	}
	
	private void initCbxMorphophoneticPreStemItems()
	{
		DefaultComboBoxModel model = new DefaultComboBoxModel();
		model.addElement("Stem doesn't change");
		model.addElement("Stem changes");
		cbxMorphophoneticPreStem.setModel(model);
	}
	public String getCbxPrefix()
	{
		return (String) cbxMorphophoneticPrefix.getSelectedItem();
	}
	
	public String getCbxInfix()
	{
		return (String) cbxMorphophoneticPreInfix.getSelectedItem();
	}
	
	public String getCbxStem()
	{
		return (String) cbxMorphophoneticPreStem.getSelectedItem();
	}
	
	public void getCbxPrefix(String s)
	{
		cbxMorphophoneticPrefix.setSelectedItem(s);
	}
	
	public void getCbxInfix(String s)
	{
		cbxMorphophoneticPreInfix.setSelectedItem(s);
	}
	public void getCbxStem(String s)
	{
		cbxMorphophoneticPreStem.setSelectedItem(s);
	}
	
	
	public void setCbxMorphophoneticPrefixListener(ActionListener AL)
	{
		cbxMorphophoneticPrefix.addActionListener(AL);
	}
	
	public void setCbxMorphophoneticPreInfixListener(ActionListener AL)
	{
		cbxMorphophoneticPreInfix.addActionListener(AL);
	}
	
	public void setCbxMorphophoneticPreStemListener(ActionListener AL)
	{
		cbxMorphophoneticPreStem.addActionListener(AL);
	}

	public void setTxtMorphophoneticNewPrefix(String s)
	{
		txtMorphophoneticNewPrefix.setText(s);
	}
	
	public void setTxtMorphophoneticPrefix(String s)
	{
		txtMorphophoneticPrefix.setText(s);
	}
	
	public void setTxtMorphophoneticPreInfix(String s)
	{
		txtMorphophoneticPreInfix.setText(s);
	}
	
	public void setTxtMorphophoneticPreNewInfix(String s)
	{
		txtMorphophoneticPreNewInfix.setText(s);
	}
	
	public void setTxtMorphophoneticPreStem(String s)
	{
		txtMorphophoneticPreStem.setText(s);
	}
	
	public void setTxtMorphophoneticPreNewStem(String s)
	{
		txtMorphophoneticPreNewStem.setText(s);
	}
	
	public String getTxtMorphophoneticNewPrefix()
	{
		return txtMorphophoneticNewPrefix.getText();
	}
	
	public String getTxtMorphophoneticPrefix()
	{
		return txtMorphophoneticPrefix.getText();
	}
	
	public String getTxtMorphophoneticPreInfix()
	{
		return txtMorphophoneticPreInfix.getText();
	}
	
	public String getTxtMorphophoneticPreNewInfix()
	{
		return txtMorphophoneticPreNewInfix.getText();
	}

	public String getTxtMorphophoneticPreStem()
	{
		return txtMorphophoneticPreStem.getText();
	}
	
	public String getTxtMorphophoneticPreNewStem()
	{
		return txtMorphophoneticPreNewStem.getText();
	}

	public void setChkMorphophoneticPrefixReduplication(ItemListener IL)
	{
		chkMorphophoneticPrefixReduplication.addItemListener(IL);
	}
	
	public void setChkMorphophoneticPreInfixReduplication(ItemListener IL)
	{
		chkMorphophoneticPreInfixReduplication.addItemListener(IL);
	}
	
	public void setChkMorphophoneticPreStemReduplication(ItemListener IL)
	{
		chkMorphophoneticPreStemReduplication.addItemListener(IL);
	}
}
